<?php

/**
 * PublicUser filter form base class.
 *
 * @package    Attitude Orchestra
 * @subpackage filter
 * @author     Attitude OÜ
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BasePublicUserFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'group_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('PublicUserGroup'), 'add_empty' => true)),
      'name'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'first_name'   => new sfWidgetFormFilterInput(),
      'last_name'    => new sfWidgetFormFilterInput(),
      'birth_year'   => new sfWidgetFormFilterInput(),
      'birth_month'  => new sfWidgetFormFilterInput(),
      'birth_day'    => new sfWidgetFormFilterInput(),
      'email'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'currency'     => new sfWidgetFormFilterInput(),
      'login'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'password'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'phone'        => new sfWidgetFormFilterInput(),
      'mobile'       => new sfWidgetFormFilterInput(),
      'address1'     => new sfWidgetFormFilterInput(),
      'address2'     => new sfWidgetFormFilterInput(),
      'city'         => new sfWidgetFormFilterInput(),
      'state'        => new sfWidgetFormFilterInput(),
      'country'      => new sfWidgetFormFilterInput(),
      'zip'          => new sfWidgetFormFilterInput(),
      'newslist'     => new sfWidgetFormFilterInput(),
      'activated_at' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'created_at'   => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'   => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'group_id'     => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('PublicUserGroup'), 'column' => 'id')),
      'name'         => new sfValidatorPass(array('required' => false)),
      'first_name'   => new sfValidatorPass(array('required' => false)),
      'last_name'    => new sfValidatorPass(array('required' => false)),
      'birth_year'   => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'birth_month'  => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'birth_day'    => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'email'        => new sfValidatorPass(array('required' => false)),
      'currency'     => new sfValidatorPass(array('required' => false)),
      'login'        => new sfValidatorPass(array('required' => false)),
      'password'     => new sfValidatorPass(array('required' => false)),
      'phone'        => new sfValidatorPass(array('required' => false)),
      'mobile'       => new sfValidatorPass(array('required' => false)),
      'address1'     => new sfValidatorPass(array('required' => false)),
      'address2'     => new sfValidatorPass(array('required' => false)),
      'city'         => new sfValidatorPass(array('required' => false)),
      'state'        => new sfValidatorPass(array('required' => false)),
      'country'      => new sfValidatorPass(array('required' => false)),
      'zip'          => new sfValidatorPass(array('required' => false)),
      'newslist'     => new sfValidatorPass(array('required' => false)),
      'activated_at' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'created_at'   => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'   => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('public_user_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'PublicUser';
  }

  public function getFields()
  {
    return array(
      'id'           => 'Number',
      'group_id'     => 'ForeignKey',
      'name'         => 'Text',
      'first_name'   => 'Text',
      'last_name'    => 'Text',
      'birth_year'   => 'Number',
      'birth_month'  => 'Number',
      'birth_day'    => 'Number',
      'email'        => 'Text',
      'currency'     => 'Text',
      'login'        => 'Text',
      'password'     => 'Text',
      'phone'        => 'Text',
      'mobile'       => 'Text',
      'address1'     => 'Text',
      'address2'     => 'Text',
      'city'         => 'Text',
      'state'        => 'Text',
      'country'      => 'Text',
      'zip'          => 'Text',
      'newslist'     => 'Text',
      'activated_at' => 'Date',
      'created_at'   => 'Date',
      'updated_at'   => 'Date',
    );
  }
}
